home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 8 / Revista CD Expert nº 08 CD1.iso / Utilitarios / Programacao / Bloodshed Dev-C++ 2.0 / _SETUP.LIB / new < prev    next >
Text File  |  1998-03-08  |  1KB  |  49 lines

  1. // The -*- C++ -*- dynamic memory management header.
  2. // Copyright (C) 1994, 1996 Free Software Foundation
  3.  
  4. #ifndef __NEW__
  5. #define __NEW__
  6.  
  7. #pragma interface "new"
  8. #include <stddef.h>
  9. #include <exception>
  10.  
  11. extern "C++" {
  12.  
  13. #if 0
  14. namespace std {
  15. #endif
  16.  
  17.   class bad_alloc : public exception {
  18.   public:
  19.     virtual const char* what() const throw() { return "bad_alloc"; }
  20.   };
  21.  
  22.   struct nothrow_t {};
  23.   extern const nothrow_t nothrow;
  24.   typedef void (*new_handler)();
  25.   extern "C" new_handler set_new_handler (new_handler);
  26.  
  27. #if 0
  28. } // namespace std
  29. #endif
  30.  
  31. // G++ implementation internals
  32. extern new_handler __new_handler;
  33. extern "C" void __default_new_handler (void);
  34.  
  35. // replaceable signatures
  36. void *operator new (size_t);
  37. void *operator new (size_t, const nothrow_t&) throw();
  38. void *operator new[] (size_t);
  39. void *operator new[] (size_t, const nothrow_t&) throw();
  40. void operator delete (void *) throw();
  41. void operator delete[] (void *) throw();
  42.  
  43. // default placement versions of operator new
  44. inline void *operator new(size_t, void *place) throw() { return place; }
  45. inline void *operator new[](size_t, void *place) throw() { return place; }
  46. } // extern "C++"
  47.  
  48. #endif
  49.